const db = require('../../models/index');
const DAO = require('../../dao/sql-option-dao');
const Website = db.website;

// 创建站点信息
exports.create = (req, res) => {
    const webInfo = req.body;
    DAO.create(Website, webInfo, data => {
        res.sendResult(data);
    })
};

// 查询站点信息列表
exports.findAll = (req, res) => {
    const fAllInfo = req.body;
    DAO.list(Website, fAllInfo, list => {
        res.sendResult(list);
    })
};

// 更新站点信息
exports.update = (req, res) => {
    const updateInfo = req.body;
    DAO.update(Website, updateInfo, {id:updateInfo.id}, data => {
        res.sendResult(data);
    });
};

// 删除站点信息
exports.delete = (req, res) => {
    const deleteInfo = req.body;
    DAO.delete(Website, { id: deleteInfo.id}, data => {
        res.sendResult(data);
    });
};

// 删除所有站点信息
exports.deleteAll = (req, res) => {
    DAO.deleteAll(Website, data => {
        res.sendResult(data)
    });
};
